if (!jsx3.lang.Class.forName("ux.cdb.admin.system.role.Role")) {
    /**
     * Define the <code>name of class</code> class.
     * This class inherit from <code>jsx3.gui.Block<code> GUI class.
     */
    jsx3.Class.defineClass(
            "ux.cdb.admin.system.role.Role",
            ux.megatron.gui.Block,
            null,
            function (objRoot) {
                objRoot.prototype.editMode = false;
                objRoot.prototype.notSavedIds = [];
                /**
                 * This method will be called after UI file has deserialized.
                 */
                objRoot.prototype.showButton = function(btnName, privilCode){
                    if(this.getPrivilege(privilCode)){
                        this.getDescendantOfName(btnName).setDisplay(jsx3.gui.Block.DISPLAYBLOCK, true);
                    } else {
                        this.getDescendantOfName(btnName).setDisplay(jsx3.gui.Block.DISPLAYNONE, true);
                    }
                };
                objRoot.prototype.hideButton = function(btnName){
                    this.getDescendantOfName(btnName).setDisplay(jsx3.gui.Block.DISPLAYNONE, true);
                }
                objRoot.prototype.initUI = function() {
                    this.getDescendantOfName("blk_privilegeList").setDisplay(jsx3.gui.Block.DISPLAYNONE, true);
                    this.getDescendantOfName("blk_detailsNoSelected").setDisplay(jsx3.gui.Block.DISPLAYBLOCK, true);
                    //this.getDescendantOfName("btn_addRole").setDisplay(jsx3.gui.Block.DISPLAYBLOCK, true);
                    this.showButton("btn_addRole", 55);
                    this.getDescendantOfName("btn_saveRole").setDisplay(jsx3.gui.Block.DISPLAYNONE, true);
                    this.getDescendantOfName("btn_cancelRole").setDisplay(jsx3.gui.Block.DISPLAYNONE, true);
                    //this.getDescendantOfName("btn_editRole").setEnabled(jsx3.gui.Form.STATEENABLED, true);
                    //this.getDescendantOfName("btn_editRole").setDisplay(jsx3.gui.Block.DISPLAYBLOCK, true);
                    this.showButton("btn_editRole", 56);
                    this.getDescendantOfName("btn_deleteRole").setDisplay(jsx3.gui.Block.DISPLAYNONE, true);
                    this.getDescendantOfName("btn_deleteRole").setEnabled(jsx3.gui.Form.STATEDISABLED, true);
                    this.getDescendantOfName("btn_editPrivilege").setEnabled(jsx3.gui.Form.STATEDISABLED, true);
                    this.showButton("btn_editPrivilege", 57);
                    this.getDescendantOfName("btn_savePrivilege").setDisplay(jsx3.gui.Block.DISPLAYNONE, true);
                    this.getDescendantOfName("btn_cancelPrivilege").setDisplay(jsx3.gui.Block.DISPLAYNONE, true);
                    this.getDescendantOfName("mcEditable").setDisplay(jsx3.gui.Block.DISPLAYNONE, true);
                    this.getDescendantOfName("mcShow").setDisplay(jsx3.gui.Block.DISPLAYBLOCK, true);
                };
                objRoot.prototype.getPrivilege = function(code) {
                    return ux.cdb.admin.Privilege.getPrivilege(code);
                };
                objRoot.prototype.getSysRoleList = function() {
                    ux.cdb.admin.CommonCache.loadCache(["SYS_ROLE_TYPE"], this, function(){
                        var roleCommonCode = ux.megatron.Main.getServer().getCache().getDocument("CommonCache_SYS_ROLE_TYPE");
                        var selType = this.getDescendantOfName("selType");
                        selType.setXMLId("CommonCache_SYS_ROLE_TYPE");
                        ux.megatron.util.Dwr.callDwr("RoleMgrUCC", "getSysRoleList", [-1, null, 1, 10000], this, function(dwrObject){
                            try{
                                dwrObject = dwrObject.content.data;
                                try{
                                    for(var i = 0; i < dwrObject.length; i ++){
                                        var roleType = dwrObject[i]["roleType"];
                                        if(roleType){
                                            dwrObject[i]["roleTypeName"] = roleCommonCode.getRecord(dwrObject[i]["roleType"])["jsxtext"];
                                        } else {
                                            dwrObject[i]["roleTypeName"] = "";
                                        }
                                    };
                                } catch(ex) {
                                    console.log(ex);
                                }
                                var cdfDoc = ux.megatron.util.Dwr.toCdfDocument(dwrObject, "jsxroot", {}, {"sysRoleId": "jsxid"});
                                this.getServer().getCache().setDocument(this.getMatrix().getXMLId(), cdfDoc);
                                this.getMatrix().repaintData();
                                if(this.roleId && !this.lastAddRoleName){
                                    //NOTE:
                                    this.getMatrix().focusCellById(this.roleId, "sysRoleId");
                                }
                                if(this.lastAddRoleName){
                                    var cdfDoc = this.getServer().getCache().getDocument(this.getMatrix().getXMLId());
                                    var addedRecord = cdfDoc.selectNodes("//record[@roleName = '" + this.lastAddRoleName + "']").get(0);
                                    var me = this;
                                    setTimeout(function(){
                                        me.getMatrix().focusCellById(addedRecord.getAttribute("jsxid"), "sysRoleId");
                                        //me.onRoleSelected(me.getMatrix(), null, addedRecord.getAttribute("jsxid"));
                                        me.onEditPrivilegeClicked();
                                        me.getDescendantOfName("btn_cancelPrivilege").setDisplay(jsx3.gui.Block.DISPLAYNONE, true);
                                    },1000);
                                } else {
                                }
                            } catch(ex){
                                //console.log(ex);
                            }
                        }, "RoleMgrUCC");
                    });
                };
                objRoot.prototype.onAfterDeserialize = function() {
                    if(!ux.megatron.Main.isFileSystem()){
                        //NOTE:
                        this.initUI();
                        this.getSysRoleList();
                    } else {
                        this.initUI();
                    };
                };
                objRoot.prototype.onRefreshRoleClicked = function(objBtn, objEVENT){
                    /*
                    ux.megatron.util.Dwr.callDwr("RoleMgrUCC", "getSysRoleList", [-1, null, 1, 10000], this, function(dwrObject){
                        try{
                            dwrObject = dwrObject.content.data;
                            var cdfDoc = ux.megatron.util.Dwr.toCdfDocument(dwrObject, "jsxroot", {}, {"sysRoleId": "jsxid"});
                            this.getServer().getCache().setDocument(this.getMatrix().getXMLId(), cdfDoc);
                            this.getMatrix().repaintData();
                            if(this.selectedJsxId)
                                this.getMatrix().selectRecord(this.selectedJsxId);
                        } catch(ex){
                            //console.log(ex);
                        }
                    }, "RoleMgrUCC");
                    */
                    this.getSysRoleList();
                };
                objRoot.prototype.onRefreshPrivilClicked = function(objBtn, objEVENT){
                    if(this.selectedJsxId){
                        var roleRecord = this.getMatrix().getRecordNode(this.selectedJsxId);
                        if(roleRecord.getAttribute("sysRoleId")){
                            try{
                                var roleName = roleRecord.getAttribute("roleName");
                                ux.megatron.util.Dwr.callDwr("RoleMgrUCC", "getRoleMenuTree", [this.roleId, roleName], this, function(dwrObject){
                                    dwrObject = dwrObject.content.data;
                                    var cdfDoc = ux.megatron.util.Dwr.toCdfDocument(dwrObject, "jsxroot", {"id": "jsxid", "menuChnName": "jsxtext", "checked": "jsxchecked"});
                                    this.getServer().getCache().setDocument(this.getPrivilMatrix().getXMLId(), cdfDoc);
                                    this.getPrivilMatrix().repaintData();
                                }, "RoleMgrUCC");
                            } catch(ex){
                                //console.log(ex);
                            }
                        } else {
                            //console.log("select new record");
                        }
                    } else {
                        //console.log("no selected");
                    }
                };
                objRoot.prototype.getMatrix = function(){
                    return this.getDescendantOfName("mtxMain");
                };
                objRoot.prototype.getPrivilMatrix = function(){
                    return this.getDescendantOfName("mtxTree");
                };
                objRoot.prototype.getCheckedNodes = function(){
                    var cdfDoc = this.getServer().getCache().getDocument(this.getDescendantOfName("mtxMain").getXMLId());
                    var checkedNodes = cdfDoc.selectNodes("record[@jsxchecked = '1']");
                    return checkedNodes;
                };
                objRoot.prototype.onEditPrivilegeClicked = function(objBtn, objEVENT){
                    if(!this.privilegeBackupDocument){
                        this.privilegeBackupDocument = this.getServer().getCache().getDocument(this.getPrivilMatrix().getXMLId()).cloneDocument();
                    }
                    this.showEditPrivilege();
                };
                objRoot.prototype.showEditPrivilege = function(){
                    this.editPrivilege = true;
                    this.getDescendantOfName("btn_editPrivilege").setDisplay(jsx3.gui.Block.DISPLAYNONE, true);
                    //this.showButton("btn_editPrivilege", 57);
                    this.getDescendantOfName("btn_savePrivilege").setDisplay(jsx3.gui.Block.DISPLAYBLOCK, true);
                    this.getDescendantOfName("btn_cancelPrivilege").setDisplay(jsx3.gui.Block.DISPLAYBLOCK, true);
                    this.getDescendantOfName("mcEditable").setDisplay(jsx3.gui.Block.DISPLAYBLOCK, true);
                    this.getDescendantOfName("mcShow").setDisplay(jsx3.gui.Block.DISPLAYNONE, true);
                    
                    this.leftStatus = {
                        "addRole": this.getDescendantOfName("btn_addRole").getEnabled(),
                        "editRole": this.getDescendantOfName("btn_editRole").getEnabled(),
                        "saveRole": this.getDescendantOfName("btn_saveRole").getEnabled(),
                        "cancelRole": this.getDescendantOfName("btn_cancelRole").getEnabled(),
                        "deleteRole": this.getDescendantOfName("btn_deleteRole").getEnabled()
                    };
                    this.getDescendantOfName("btn_addRole").setEnabled(jsx3.gui.Form.STATEDISABLED, true);
                    this.getDescendantOfName("btn_editRole").setEnabled(jsx3.gui.Form.STATEDISABLED, true);
                    this.getDescendantOfName("btn_saveRole").setEnabled(jsx3.gui.Form.STATEDISABLED, true);
                    this.getDescendantOfName("btn_cancelRole").setEnabled(jsx3.gui.Form.STATEDISABLED, true);
                    this.getDescendantOfName("btn_deleteRole").setEnabled(jsx3.gui.Form.STATEDISABLED, true);
                    this.getDescendantOfName("blk_Pagination").showMask();
                    this.getDescendantOfName("blk_Matrix").showMask();
                };
                objRoot.prototype.hideEditPrivilege = function(){
                    this.editPrivilege = false;
                    try{
                        //this.getDescendantOfName("btn_editPrivilege").setDisplay(jsx3.gui.Block.DISPLAYBLOCK, true);
                        this.showButton("btn_editPrivilege", 57);
                        this.getDescendantOfName("btn_savePrivilege").setDisplay(jsx3.gui.Block.DISPLAYNONE, true);
                        this.getDescendantOfName("btn_cancelPrivilege").setDisplay(jsx3.gui.Block.DISPLAYNONE, true);
                        this.getDescendantOfName("mcEditable").setDisplay(jsx3.gui.Block.DISPLAYNONE, true);
                        this.getDescendantOfName("mcShow").setDisplay(jsx3.gui.Block.DISPLAYBLOCK, true);

                        this.getDescendantOfName("btn_addRole").setEnabled(this.leftStatus["addRole"], true);
                        this.getDescendantOfName("btn_editRole").setEnabled(this.leftStatus["editRole"], true);
                        this.getDescendantOfName("btn_saveRole").setEnabled(this.leftStatus["saveRole"], true);
                        this.getDescendantOfName("btn_cancelRole").setEnabled(this.leftStatus["cancelRole"], true);
                        this.getDescendantOfName("btn_deleteRole").setEnabled(this.leftStatus["deleteRole"], true);
                        this.getDescendantOfName("blk_Pagination").hideMask();
                        this.getDescendantOfName("blk_Matrix").hideMask();
                    } catch(ex){
                        alert(ex);
                    }
                };
                objRoot.prototype.onSavePrivilegeClicked = function(objBtn, objEVENT){
                    if(!ux.megatron.Main.isFileSystem()){
                        try{
                            //NOTE:
                            var cdfDoc = this.getServer().getCache().getDocument(this.getPrivilMatrix().getXMLId());
                            var ifReturn = false;
                            if (cdfDoc == this.privilegeBackupDocument){
                                ifReturn = true;
                                var title = ux.megatron.Main.getServer().getDynamicProperty("@cdb@System@Role@dlgAddFailedTitle");
                                var content = ux.megatron.Main.getServer().getDynamicProperty("@cdb@System@Role@dlgNoEditSavePrivil");
                                ux.megatron.Dialog.alert(title, content, function(objDialog){
                                    objDialog.doClose();
                                });
                            }
                            if(ifReturn){
                                return;
                            }
                            //NOTE:
                            var checkedNodes = cdfDoc.selectNodes("//record[@jsxchecked = '1']");
                            if(checkedNodes.size() == 0){
                                ifReturn = true;
                                var title = ux.megatron.Main.getServer().getDynamicProperty("@cdb@System@Role@dlgAddFailedTitle");
                                var content = ux.megatron.Main.getServer().getDynamicProperty("@cdb@System@Role@dlgNoPrivil");
                                ux.megatron.Dialog.alert(title, content, function(objDialog){
                                    objDialog.doClose();
                                });
                            }
                            if(ifReturn)
                                return;
                            var moduleIds = [];
                            var i = checkedNodes.iterator();
                            while(i.hasNext()){
								var id = i.next().getAttribute("jsxid");
                                //console.log(id);
                                moduleIds.push(id);
                            }
							var roleObject = this.getMatrix().getRecord(this.roleId);
							roleObject["sysRoleId"] = roleObject["jsxid"];
                            var dwrInput = [roleObject, moduleIds];
							//console.log(dwrInput);
                            ux.megatron.util.Dwr.callDwr("RoleMgrUCC", "updateRoleMenuTree", dwrInput, this, function(dwrObject){
                                //console.log(dwrObject);
                                this.privilegeBackupDocument = null;
                                this.hideEditPrivilege();
                            }, "RoleMgrUCC");
                        } catch(ex) {
                            alert(ex);
                        }
                    } else {
                        this.hideEditPrivilege();
                    }
                };
                objRoot.prototype.onCancelPrivilegeClicked = function(objBtn, objEVENT){
                    this.getServer().getCache().setDocument(this.getPrivilMatrix().getXMLId(), this.privilegeBackupDocument);
                    this.privilegeBackupDocument = null;
                    this.hideEditPrivilege();
                };
                objRoot.prototype.onRoleChecked = function(objChk, objEVENT, intCHECKED){
                    var checkedNodes = this.getCheckedNodes();
                    if(checkedNodes.size() == 0){
                        this.disableDelete();
                    } else {
                        this.enableDelete();
                    };
                };
                objRoot.prototype.onPrivilegeChecked = function(objChk, objEVENT, intCHECKED){
                    var mtx = objChk.emGetSession().matrix;
                    var recordId = objChk.emGetSession().recordId;
                    var record = mtx.getRecordNode(recordId);
                    if(intCHECKED){
                        while(record = record.getParent()){
                            record.setAttribute("jsxchecked", 1);
                        }
                    } else {
                        var setChecked = function(record) {
                            record.setAttribute("jsxchecked", 0);
                            var i = record.getChildIterator();
                            while(i.hasNext()){
                                setChecked(i.next());
                            };
                        };
                        setChecked(record);

                    }
                    mtx.repaintData();
                };
                objRoot.prototype.onNewClicked = function(objBtn, objEVENT){
                    if(!this.backupDocument)
                        this.backupDocument = this.getServer().getCache().getDocument(this.getMatrix().getXMLId()).cloneDocument();
                    var jsxid = jsx3.xml.CDF.getKey();
                    var record = this.getMatrix().insertRecord({"jsxid": jsxid},null,false);
                    this.getMatrix().repaint();
                    this.getMatrix().selectRecord(jsxid);
                    this.hidePrivilege();
                    this.enterEditMode();

                };
                objRoot.prototype.onWizardLoaded = function() {
                    var wizPane = this.getServer().getRootBlock().getDescendantOfName("wizPane_1");
                    var checkedNode = this.getCheckedNodes().get(0);
                    if(checkedNode){
                        try{
                            wizPane.setData(this.getDescendantOfName("mtxMain").getRecord(checkedNode.getAttribute("jsxid")));
                        } catch(ex) {
                            alert(ex);
                        }
                    } else {
                        alert("error");
                    }
                };
                objRoot.prototype.onModifyClicked = function(objBtn, objEVENT){
                    this.enterEditMode();
                };

                objRoot.prototype.onSaveClicked = function(objBtn, objEVENT){
                    //NOTE:
                    var ifReturn = false;
                    var cdfDoc = this.getServer().getCache().getDocument(this.getMatrix().getXMLId());
                    if ((cdfDoc != this.backupDocument) && (this.notSavedIds.length == 0)){
                        ifReturn = true;
                        var title = ux.megatron.Main.getServer().getDynamicProperty("@cdb@System@Role@dlgAddFailedTitle");
                        var content = ux.megatron.Main.getServer().getDynamicProperty("@cdb@System@Role@dlgAddFailed");
                        ux.megatron.Dialog.alert(title, content, function(objDialog){
                            objDialog.doClose();
                        });
                    }
                    if(ifReturn){
                        return;
                    }
                    //NOTE:
                    try{
                        var id = null;
                        var updateRecords = [];
                        var addRecords = [];
                        while(id = this.notSavedIds.pop()){
                            var record = this.getMatrix().getRecord(id);
                            //NOTE: Valid;
                            var valid = true;
                            if(!record["roleName"] || !record["roleDesc"]){
                                valid = false;
                                var title = ux.megatron.Main.getServer().getDynamicProperty("@cdb@System@Role@dlgAddFailedTitle");
                                var content = ux.megatron.Main.getServer().getDynamicProperty("@cdb@System@Role@dlgAddFailed");
                                ux.megatron.Dialog.alert(title, content, function(objDialog){
                                    objDialog.doClose();
                                });
                            }
                            if(!valid)
                                return;
                            //NOTE: Record;
                            if(record["sysRoleId"]){
                                updateRecords.push(record);
                            } else {
                                addRecords.push(record);
                                this.lastAddRoleName = record["roleName"];
                            }
                        };
						if(updateRecords.length > 0){
							ux.megatron.util.Dwr.callDwr("RoleMgrUCC", "updateSysRoles", [updateRecords], this, function(dwrObject){
                                this.onAfterDeserialize();
							}, "RoleMgrUCC");
						}
                        if(addRecords.length > 0){
							ux.megatron.util.Dwr.callDwr("RoleMgrUCC", "addSysRoles", [addRecords], this, function(dwrObject){
                                this.onAfterDeserialize();
							}, "RoleMgrUCC");
						}
						this.quitEditMode();
                    } catch(ex){
                        alert(ex);
                    }
                };

                objRoot.prototype.onCancelClicked = function(objBtn, objEVENT) {
                    this.getServer().getCache().setDocument(this.getMatrix().getXMLId(), this.backupDocument);
                    if(this.toDeleteFromBackupIds){
                        var id;
                        while(id = this.toDeleteFromBackupIds.pop()){
                            this.getMatrix().deleteRecord(id, false);
                        }
                        this.toDeleteFromBackupIds = null;
                    }
                    this.getMatrix().repaintData();
                    this.backupDocument = null;
                    this.quitEditMode();
                };
                objRoot.prototype.enterEditMode = function(){
                    if(!this.backupDocument)
                        this.backupDocument = this.getServer().getCache().getDocument(this.getMatrix().getXMLId()).cloneDocument();
                    //alert(this.backupDocument);
                    try{
                        this.getDescendantOfName("btn_saveRole").setDisplay(jsx3.gui.Block.DISPLAYBLOCK, true);
                        this.getDescendantOfName("btn_saveRole").setEnabled(jsx3.gui.Form.STATEENABLED, true);
                        this.getDescendantOfName("btn_cancelRole").setDisplay(jsx3.gui.Block.DISPLAYBLOCK, true);
                        this.getDescendantOfName("btn_cancelRole").setEnabled(jsx3.gui.Form.STATEENABLED, true);
                        this.getDescendantOfName("btn_editRole").setDisplay(jsx3.gui.Block.DISPLAYNONE, true);
                        this.getDescendantOfName("btn_editPrivilege").setEnabled(jsx3.gui.Form.STATEDISABLED, true);
                    } catch(ex) {
                        alert(ex);
                    }
                    this.editMode = true;
                    if(this.getMatrix().getSelectedIds()[0]){
                        var focusId = this.getMatrix().getSelectedIds()[0];
                    } else {
                        var cdfDoc = this.getServer().getCache().getDocument(this.getMatrix().getXMLId());
                        var focusId = cdfDoc.getFirstChild().getAttribute("sysRoleId");
                    }
                    this.getMatrix().focusCellById(focusId, "sysRoleId");
                };
                objRoot.prototype.quitEditMode = function(){
                    this.getDescendantOfName("btn_saveRole").setDisplay(jsx3.gui.Block.DISPLAYNONE, true);
                    this.getDescendantOfName("btn_cancelRole").setDisplay(jsx3.gui.Block.DISPLAYNONE, true);
                    //this.getDescendantOfName("btn_editRole").setDisplay(jsx3.gui.Block.DISPLAYBLOCK, true);
                    this.showButton("btn_editRole", 56);
                    this.getDescendantOfName("btn_editPrivilege").setEnabled(jsx3.gui.Form.STATEENABLED, true);
                    this.notSavedIds = [];
                    this.editMode = false;
                    this.backupDocument = null;
                    if(!this.getMatrix().getSelectedIds()[0]){
                        this.hidePrivilege();
                    }
                };
                objRoot.prototype.onRemoveClicked = function(objBtn, objEVENT){
                    var me = this;
                    var mtx = this.getMatrix();
                    var _c = ux.megatron.Dialog.confirm(this.getServer().getDynamicProperty("@cdb@System@Role@dlgConfirmTitle"), 
                                                        this.getServer().getDynamicProperty("@cdb@System@Role@dlgConfirmMessage#DeleteRecord"), 
                    function(objDialog){
                        var checkedNodes = me.getCheckedNodes();
                        var i = checkedNodes.iterator();
                        var ids = [];
                        while(i.hasNext()){
                            ids.push(i.next().getAttribute("jsxid"));
                        }
                        ux.megatron.util.Dwr.callDwr("RoleMgrUCC", "deleteSysRoles", [ids], me, function(dwrObject){
                            //console.log(dwrObject);
                            if(me.backupDocument)
                                me.toDeleteFromBackupIds = ids;
                            for(var i = 0; i < ids.length; i ++){
                                mtx.deleteRecord(ids[i], false);
                            }
                            me.disableDelete();
                            mtx.repaintData();
                            if(!mtx.getRecord(this.selectedJsxId)){
                                this.selectedJsxId = null;
                                this.hidePrivilege();
                            }
                            objDialog.doClose();
                        }, "RoleMgrUCC");
                    }, function(objDialog){objDialog.doClose();}, "OK", "Cancel");

                };
                objRoot.prototype.onRoleSelected = function(objMtx, objEVENT, strRECORDID){
                    var roleRecord = objMtx.getRecordNode(strRECORDID);
                    if(roleRecord.getAttribute("sysRoleId")){
                        this.selectedJsxId = roleRecord.getAttribute("jsxid");
                        this.roleId = roleRecord.getAttribute("sysRoleId");
                        var roleName = roleRecord.getAttribute("roleName");
                        if(!ux.megatron.Main.isFileSystem()){
                            //TODO: Call Dwr method to load privilege for selected role;
                            ux.megatron.util.Dwr.callDwr("RoleMgrUCC", "getRoleMenuTree", [this.roleId, roleName], this, function(dwrObject){
                                dwrObject = dwrObject.content.data;
                                var cdfDoc = ux.megatron.util.Dwr.toCdfDocument(dwrObject, "jsxroot", {"id": "jsxid", "menuChnName": "jsxtext", "checked": "jsxchecked"});
                                this.getServer().getCache().setDocument(this.getPrivilMatrix().getXMLId(), cdfDoc);
                                this.getPrivilMatrix().repaintData();
                                this.showPrivilege();
                            }, "RoleMgrUCC");
                        } else {
                            this.showPrivilege();
                        }
                    } else {
                        this.selectedJsxId = null;
                        this.roleId = null;
                        this.hidePrivilege();
                    }
                };
                objRoot.prototype.onBeforeEdit = function(objMtx, objEVENT, strRECORDID, objCOLUMN){
                    return this.editMode;
                };
                objRoot.prototype.onAfterEdit = function(objMtx, objEVENT, strRECORDID, objCOLUMN, strNEWVALUE){
                    if (objCOLUMN.getName() == "mcType") {
                        var node = this.getMatrix().getRecordNode(strRECORDID);
                        var selection = this.getDescendantOfName("selType");
                        node.setAttribute("roleTypeName", selection.getText());
                        node.setAttribute("roleType", selection.getValue());
                    }
                    if(this.notSavedIds.indexOf(strRECORDID) == -1)
                        this.notSavedIds.push(strRECORDID);
                    return strNEWVALUE;
                };
                objRoot.prototype.showPrivilege = function(){
                    this.getDescendantOfName("blk_detailsNoSelected").setDisplay(jsx3.gui.Block.DISPLAYNONE, true);
                    this.getDescendantOfName("blk_privilegeList").setDisplay(jsx3.gui.Block.DISPLAYBLOCK, true);
                    if(this.editMode)
                        this.getDescendantOfName("btn_editPrivilege").setEnabled(jsx3.gui.Form.STATEDISABLED, true);
                    else
                        this.getDescendantOfName("btn_editPrivilege").setEnabled(jsx3.gui.Form.STATEENABLED, true);
                };
                objRoot.prototype.hidePrivilege = function(){
                    this.getDescendantOfName("blk_detailsNoSelected").setDisplay(jsx3.gui.Block.DISPLAYBLOCK, true);
                    this.getDescendantOfName("blk_privilegeList").setDisplay(jsx3.gui.Block.DISPLAYNONE, true);
                    this.getDescendantOfName("btn_editPrivilege").setEnabled(jsx3.gui.Form.STATEDISABLED, true);
                };
                objRoot.prototype.enableEdit = function(){
                    this.getDescendantOfName("btn_editRole").setEnabled(jsx3.gui.Form.STATEENABLED, true);
                };
                objRoot.prototype.disableEdit = function(){
                    this.getDescendantOfName("btn_editRole").setEnabled(jsx3.gui.Form.STATEDISABLED, true);
                };
                objRoot.prototype.enableDelete = function(){
                    this.getDescendantOfName("btn_deleteRole").setEnabled(jsx3.gui.Form.STATEENABLED, true);
                };
                objRoot.prototype.disableDelete = function(){
                    this.getDescendantOfName("btn_deleteRole").setEnabled(jsx3.gui.Form.STATEDISABLED, true);
                };
            }
    );
}
